<?php

class ContextHelper extends Helper {

  var $method = '';
  var $session = '';
  var $name = '';

  // assigns values of referencing controller
  function startup(&$controller) {
    $this->session=$controller->Session->check('User');
    $this->name=$controller->name;
  }

  function checkSession(&$controller) {
    if (!$this->session) {
      $controller->redirect('/admin/users/login');
      exit();
    }
  }

  function currentcontroller($id) {
    if ($id==$this->name) {
      return 'current';
    }
  }

  function currentmethod($id) {
    if ($id==$this->method) {
      return 'current';
    }
  }

}
?>